<!DOCTYPE html>
<html>
	<head>
		<title>Filtering via a separate input element</title>
		<link rel="stylesheet" href="../../../codebase/webix.css" type="text/css" charset="utf-8">
		<script src="../../../codebase/webix.js" type="text/javascript" charset="utf-8"></script>

		<link rel="stylesheet" type="text/css" href="../common/samples.css">
		<script src="../common/testdata.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div class='header_comment'>Filtering via a separate input element</div>
		<div class='sample_comment'>Type some year in the input below and click button 'Filter'. The grid will be filtered by the 'Released' column.</div>
		<input type="text"><input type="button" value='filter' onclick='filterText(this);'>
		<div id="testA"></div>
		<script type="text/javascript" charset="utf-8">
		function filterText(node){
			var text = node.previousSibling.value;
			if (!text) return grid.filter();

			grid.filter(function(obj){
				return obj.year == text;
			})
		}
		webix.ready(function(){
			grid = new webix.ui({
				container:"testA",
				view:"datatable",
				columns:[
					{ id:"rank",	header:"", css:"rank",  width:50,	sort:"int"},
					{ id:"title",	header:"Film title",	width:200,	sort:"string"},
					{ id:"year",	header:"Released",	width:80,	sort:"int"},
					{ id:"votes",	header:"Votes", 		width:100,	sort:"int"}
				],
				autoheight:true,
				autowidth:true,
				data:small_film_set
			});	
		});
		</script>
	</body>
</html>